package tools;

import java.util.LinkedList;

public class Node<T> {
	
	T value;
	int level;
	public LinkedList<Node<T>> children;
	public Node<T> parent;
	
	public Node(T value) {
		this.value = value;
		children = new LinkedList<Node<T>>();
		parent = null;
		level = 0;
	}
	
	public void addChild(Node<T> n) {
		children.add(n);
		n.parent = this;
		n.level = this.level + 1;
	}
	
	@Override
	public String toString() {
		return level + ":" + value.toString();
	}


}
